Skip to content

Add child context logger to the ctx.console #729

Open
sevauni wants to merge 7 commits into
restatedev:mainfrom
sevauni:main
Open

Add child context logger to the ctx.console #729
sevauni wants to merge 7 commits into
restatedev:mainfrom
sevauni:main

Conversation

@sevauni

@sevauni sevauni commented May 30, 2026

Copy link
Copy Markdown

Hello! Thank you for this app!

I recently started to work with it and found a small thing that I really miss in the api of the logger

Adds ctx.console.child() so it's possible to attach some additional context to the logger (like in winston or pino libraries)
context itself is not durable but recreated on each rerun from the persistent results of any ctx outputs

let log = ctx.console.child({ orderId: input.orderId });

const payment = await ctx.run("charge payment", () => charge(input));
log = log.child({ paymentId: payment.id });

log.info("payment charged");

It's would really nice to have becuase every log line can carry the workflow context accumulated so far without manually repeating those fields in each log call (e.g. add userId and then filter in logs all entries for this user)

@sevauni sevauni marked this pull request as ready for review May 30, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant